package Demo10;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadDemo {
    /**
     * 线程池
     */
    public static void main(String[] args) throws InterruptedException {


        // 创建线程池
//        ExecutorService poll1 = Executors.newCachedThreadPool();
        ExecutorService poll1 = Executors.newFixedThreadPool(5);

        poll1.submit(new MyRun());

        poll1.submit(new MyRun());

        poll1.submit(new MyRun());

        poll1.submit(new MyRun());

        poll1.submit(new MyRun());

        poll1.submit(new MyRun());

        // 销毁
        poll1.shutdown();
    }
}
